home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / x11 / strategy / xsok-1.000 / xsok-1 / xsok-1.01 / src / convertscore.c < prev    next >
C/C++ Source or Header  |  1994-11-24  |  633b  |  28 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* convert a savegame file from the alpha version to the beta version */
  5.  
  6. int main(void) {
  7.     long len;
  8.     unsigned char p[64];
  9.     unsigned char s[10000];
  10.     memset(p, 0xff, sizeof(p));
  11.     fread(p, 32, 1, stdin);
  12.     
  13.     len = fread(s, 1, 10000, stdin);
  14.  
  15.     memcpy(p+28, p+12, 4);    /* stored move */
  16.     memset(p+20, 0, 8);
  17.     p[23] = 1;        /* assume it's finished */
  18.     p[27] = s[7];    /* level */
  19.     memcpy(p+48, p+12, 4);    /* bookmark where started */
  20.     if (s[0] == 'C')
  21.     s[7] = 'x';
  22.     else
  23.     s[7] = '\0';
  24.     fwrite(p, 1, 64, stdout);
  25.     fwrite(s, 1, len, stdout);
  26.     return 0;
  27. }
  28.